var verifyServer=['http://verify2.xunlei.com/','http://verify1.xunlei.com/','http://verify3.xunlei.com/'];
var verifyQuery = null;
var verify_times = 0;
function getVerifyCode(d, t){
	window.clearInterval(verifyQuery);
	var verify_img = document.getElementById(d);
	if(verify_img) {
		getVerifyImage(d, t);
		verifyQuery = window.setInterval('getVerifyImage(\''+d+'\', \''+t+'\')',5000);
	}
}

function getVerifyImage(d, t) {
	var verify_img = document.getElementById(d);
	if (verify_times >= verifyServer.length) {
		window.clearInterval(verifyQuery);
		verify_times = 0;
		return;
	}
	if(verify_img) {
		verify_img.src = verifyServer[verify_times]+'image?t=MVA&cachetime='+new Date().getTime();
		verify_times++;
		verify_img.onerror = function() {
			return;
		};
		if($.browser.msie){
			verify_img.onreadystatechange = function() {
				if(verify_img.readyState == "complete"){
					window.clearInterval(verifyQuery);
					verify_img.height = 56;
					verify_img.width = 140;
					document.getElementById(t).innerHTML='换一张(不区分大小写)';
					verify_times = 0;
					return;
				}
			}       
		}else{
			verify_img.onload = function(){
				if(verify_img.complete == true){
					window.clearInterval(verifyQuery);
					verify_img.height = 56;
					verify_img.width = 140;
					document.getElementById(t).innerHTML='换一张(不区分大小写)';
					verify_times = 0;
					return;
				}
			}       
		} 
	}
}
//add by 浩威
function getVerifyCode2(d){
	window.clearInterval(verifyQuery);
	var verify_img = document.getElementById(d);
	if(verify_img) {
		getVerifyImage2(d);
		verifyQuery = window.setInterval('getVerifyImage2(\''+d+'\')',5000);
	}
}

function getVerifyImage2(d) {
	var verify_img = document.getElementById(d);
	if (verify_times >= verifyServer.length) {
		window.clearInterval(verifyQuery);
		verify_times = 0;
		return;
	}
	if(verify_img) {
		verify_img.src = verifyServer[verify_times]+'image?t=MVA&cachetime='+new Date().getTime();
		verify_times++;
		verify_img.onerror = function() {
			return;
		};
		if($.browser.msie){
			verify_img.onreadystatechange = function() {
				if(verify_img.readyState == "complete"){
					window.clearInterval(verifyQuery);
					verify_img.height = 56;
					verify_img.width = 140;
					verify_times = 0;
					return;
				}
			}       
		}else{
			verify_img.onload = function(){
				if(verify_img.complete == true){
					window.clearInterval(verifyQuery);
					verify_img.height = 56;
					verify_img.width = 140;
					verify_times = 0;
					return;
				}
			}       
		} 
	}
}